package com.learn.sunday.auth.controller;

import com.learn.sunday.auth.service.UserService;
import com.learn.sunday.common.service.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("auth/v1")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping(value = "login")
    public void login(HttpServletRequest request, HttpServletResponse response) {
        userService.login(request,response);
    }

    @GetMapping(value = "users")
    public ResponseUtil getUserList() {
        return userService.getUserList();
    }
}
